import request from "@/utils/request";

//获取商品类型列表
export function getSkuType(pageIndex,pageSize,className) {
  return request({
    url: 'vm-service/skuClass/search',
    method: 'get',
    params: {
      pageIndex,pageSize,className
    },
    contentType : "application/x-www-form-urlencoded; charset=utf-8"
  })
}
 //新建商品类型
 export function addSkuType(data) {
  return request({
    url: 'vm-service/skuClass',
    method: 'post',
    data
  })
}
 //修改商品类型
 export function changeSkuType(data,id) {
  return request({
    url: `vm-service/skuClass/${id}`,
    method: 'put',
   data,
  })
}
//删除商品类型
export function delSkuType(classId) {
  return request({
    url: `vm-service/skuClass/${classId}`,
    method: 'delete',
  })
}
//获得商品类型列表
export function getallSkuclass() {
  return request({
    url: 'vm-service/skuClass/search',
    method: 'get',
    params: {
      pageIndex:1,pageSize:1000
    },
  })
}

//获取商品列表
export function getSku(pageIndex,pageSize,className) {
  return request({
    url: 'vm-service/sku/search',
    method: 'get',
    params: {
      pageIndex,pageSize,className
    },
    contentType : "application/x-www-form-urlencoded; charset=utf-8"
  })
}
 //新建商品
 export function addSku(data) {
  return request({
    url: 'vm-service/sku',
    method: 'post',
    data
  })
}
 //修改商品
 export function changeSku(data,id) {
  return request({
    url: `vm-service/sku/${id}`,
    method: 'put',
   data,
  })
}
//文件上传
export function uploaddata(data) {
  return request({
    url: `vm-service/sku/upload`,
    method: 'post',
   data,
  })
}